import { reactive } from 'vue'
import { createStore } from 'vuex'
import urls from '../api/index'

export default createStore({
  state: reactive({
    hederList: <Array<any>>[],
    lang: <string>'zh_CN',
    loading: false,
    breadcrumbList: <Array<any>>[]
  }),
  getters: {
  },
  mutations: {
    CHNAGELAN: (state, val) => {
      state.lang = val
    },
    CHANGELOAD: (state, val) => {
      state.loading = val
    },
    ADDBREADCRUMB: (state, val) => {
      state.breadcrumbList = [{
        path: '/',
        name: 'message.HOME'
      }, ...val]
    }
  },
  actions: {
    changeLan ({ commit }, lang) {
      if (lang === 'zh_CN') {
        commit('CHANGELAN', 'en_US')
      } else {
        commit('CHANGELAN', 'zh_CN')
      }
    }
  },
  modules: {
  }
})
